package bll;

import javax.servlet.http.HttpSession;

import util.AuthenticationUtil;

public class AuthorizationBll {

	private static boolean[][] menuMatrix = new boolean[][] { {},

	{ true, true, true, true, true },

	{},

	{},

	{},

	{},

	{},

	{},

	{},

	{},

	{},

	{},

	{} };

	public static boolean checkMenuRight(int menu, HttpSession session) {
		boolean res = false;

		// TODO

		int accountType = AuthenticationUtil.getAccoutType(session);

		if (accountType == Enums.AccountType.Director.getId()) {
			return true;
		}

		if (menu == Enums.Menu.Home.getId()) {
			res = true;
		}

		else if (menu == Enums.Menu.PM.getId()) {
			if (accountType == Enums.AccountType.ClientManager.getId()
					|| accountType == Enums.AccountType.Admin.getId()
					|| accountType == Enums.AccountType.CostManager.getId()
					|| accountType == Enums.AccountType.Director.getId()
					|| accountType == Enums.AccountType.ProjectManager.getId()
					|| accountType == Enums.AccountType.Staff.getId()) {
				res = true;
			}
		} else if (menu == Enums.Menu.PM_NewProject.getId()) {
			if (accountType == Enums.AccountType.ClientManager.getId()
					|| accountType == Enums.AccountType.Admin.getId()
					|| accountType == Enums.AccountType.CostManager.getId()
					|| accountType == Enums.AccountType.Director.getId()
					|| accountType == Enums.AccountType.ProjectManager.getId()
					|| accountType == Enums.AccountType.Staff.getId()) {
				res = true;
			}
		} else if (menu == Enums.Menu.PM_Phase.getId()) {
			if (accountType == Enums.AccountType.ClientManager.getId()
					|| accountType == Enums.AccountType.Admin.getId()
					|| accountType == Enums.AccountType.CostManager.getId()
					|| accountType == Enums.AccountType.Director.getId()
					|| accountType == Enums.AccountType.ProjectManager.getId()
					|| accountType == Enums.AccountType.Staff.getId()) {
				res = true;
			}
		} else if (menu == Enums.Menu.PM_Quotation.getId()) {
			if (accountType == Enums.AccountType.ClientManager.getId()
					|| accountType == Enums.AccountType.Admin.getId()
					|| accountType == Enums.AccountType.CostManager.getId()
					|| accountType == Enums.AccountType.Director.getId()
					|| accountType == Enums.AccountType.ProjectManager.getId()
					|| accountType == Enums.AccountType.Staff.getId()) {
				res = true;
			}
		} else if (menu == Enums.Menu.PM_Agenda.getId()) {
			if (accountType == Enums.AccountType.ClientManager.getId()
					|| accountType == Enums.AccountType.Admin.getId()
					|| accountType == Enums.AccountType.CostManager.getId()
					|| accountType == Enums.AccountType.Director.getId()
					|| accountType == Enums.AccountType.ProjectManager.getId()
					|| accountType == Enums.AccountType.Staff.getId()) {
				res = true;
			}
		} else if (menu == Enums.Menu.PM_Checklist.getId()) {
			if (accountType == Enums.AccountType.ClientManager.getId()
					|| accountType == Enums.AccountType.Admin.getId()
					|| accountType == Enums.AccountType.CostManager.getId()
					|| accountType == Enums.AccountType.Director.getId()
					|| accountType == Enums.AccountType.ProjectManager.getId()
					|| accountType == Enums.AccountType.Staff.getId()) {
				res = true;
			}
		} else if (menu == Enums.Menu.PM_Event.getId()) {
			if (accountType == Enums.AccountType.ClientManager.getId()
					|| accountType == Enums.AccountType.Admin.getId()
					|| accountType == Enums.AccountType.CostManager.getId()
					|| accountType == Enums.AccountType.Director.getId()
					|| accountType == Enums.AccountType.ProjectManager.getId()
					|| accountType == Enums.AccountType.Staff.getId()) {
				res = true;
			}
		}

		else if (menu == Enums.Menu.CRM.getId()) {
			if (accountType == Enums.AccountType.ClientManager.getId()
					|| accountType == Enums.AccountType.Admin.getId()
					|| accountType == Enums.AccountType.CostManager.getId()
					|| accountType == Enums.AccountType.Director.getId()
					|| accountType == Enums.AccountType.ProjectManager.getId()
					|| accountType == Enums.AccountType.Staff.getId()) {
				res = true;
			}
		} else if (menu == Enums.Menu.CRM_Client.getId()) {
			if (accountType == Enums.AccountType.ClientManager.getId()
					|| accountType == Enums.AccountType.Admin.getId()
					|| accountType == Enums.AccountType.CostManager.getId()
					|| accountType == Enums.AccountType.Director.getId()
					|| accountType == Enums.AccountType.ProjectManager.getId()
					|| accountType == Enums.AccountType.Staff.getId()) {
				res = true;
			}
		} else if (menu == Enums.Menu.CRM_Competitor.getId()) {
			if (accountType == Enums.AccountType.ClientManager.getId()
					|| accountType == Enums.AccountType.Admin.getId()
					|| accountType == Enums.AccountType.CostManager.getId()
					|| accountType == Enums.AccountType.Director.getId()
					|| accountType == Enums.AccountType.ProjectManager.getId()
					|| accountType == Enums.AccountType.Staff.getId()) {
				res = true;
			}
		} else if (menu == Enums.Menu.CRM_Person.getId()) {
			if (accountType == Enums.AccountType.ClientManager.getId()
					|| accountType == Enums.AccountType.Admin.getId()
					|| accountType == Enums.AccountType.CostManager.getId()
					|| accountType == Enums.AccountType.Director.getId()
					|| accountType == Enums.AccountType.ProjectManager.getId()
					|| accountType == Enums.AccountType.Staff.getId()) {
				res = true;
			}
		} else if (menu == Enums.Menu.CRM_Broker.getId()) {
			if (accountType == Enums.AccountType.ClientManager.getId()
					|| accountType == Enums.AccountType.Admin.getId()
					|| accountType == Enums.AccountType.CostManager.getId()
					|| accountType == Enums.AccountType.Director.getId()
					|| accountType == Enums.AccountType.ProjectManager.getId()
					|| accountType == Enums.AccountType.Staff.getId()) {
				res = true;
			}
		}

		else if (menu == Enums.Menu.HRM.getId()) {

		} else if (menu == Enums.Menu.HRM_Employee.getId()) {

		} else if (menu == Enums.Menu.HRM_Workload.getId()) {

		}

		else if (menu == Enums.Menu.SCM.getId()) {

		} else if (menu == Enums.Menu.SCM_Product.getId()) {

		} else if (menu == Enums.Menu.SCM_Service.getId()) {

		} else if (menu == Enums.Menu.SCM_Purchase.getId()) {

		} else if (menu == Enums.Menu.SCM_Supplier.getId()) {

		} else if (menu == Enums.Menu.SCM_Supply.getId()) {

		}

		else if (menu == Enums.Menu.CMS.getId()) {

		} else if (menu == Enums.Menu.CMS_Document.getId()) {

		} else if (menu == Enums.Menu.CMS_DocumentType.getId()) {

		}

		else if (menu == Enums.Menu.FAM.getId()) {

		} else if (menu == Enums.Menu.FAM_Cashflow.getId()) {

		} else if (menu == Enums.Menu.FAM_Receivable.getId()) {

		}

		else if (menu == Enums.Menu.Others.getId()) {

		} else if (menu == Enums.Menu.Others_Company.getId()) {

		} else if (menu == Enums.Menu.Others_Place.getId()) {

		} else if (menu == Enums.Menu.Others_Unit.getId()) {

		} else if (menu == Enums.Menu.Others_Venue.getId()) {

		}

		return res;
	}
}
